package com.offcn.itemweb.controller;

import com.offcn.common.entity.Result;
import com.offcn.common.entity.StatusCode;
import com.offcn.itemweb.service.ItemwebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("page")
public class itemwebController {
    @Autowired
    private ItemwebService itemService;
    /**
     * 接受到请求之后
     *
     * @param goodsId
     * @return
     */
    @GetMapping("createHtml/{goodsId}")
    public Result createHtml(@PathVariable(value = "goodsId", required = false) Long goodsId){
        try {
            itemService.createHtml(goodsId);
            return new Result(true, StatusCode.OK, "生成成功");
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, StatusCode.ERROR, "生成失败");
        }
    }
}
